﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/ADAdminLayout.master" AutoEventWireup="true"
    CodeFile="phieu_giam_gia.aspx.cs" Inherits="admin_Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="block" id="block-tables">
        <div class="content">
            <h2 class="title">
                Phiếu Giảm Giá</h2>
            <div class="inner">
                <div class="group">
                    <label>
                        Từ khóa:</label>
                    <asp:TextBox ID="TextBox1" runat="server" class="text_field" size="60"></asp:TextBox>
                    &nbsp;
                    <label>
                        Tìm theo:
                    </label>
                    <select>
                        <option>Tên doanh nghiệp</option>
                        <option>Tên sản phẩm</option>
                        <option>Mã phiếu</option>
                    </select>
                    &nbsp;
                    <button class="button slim-button" type="submit">
                        <img src="./images/search.png" alt="Tìm kiếm">
                        Tìm kiếm</button>
                </div>
                <br />
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                    AutoGenerateColumns="False" CssClass="table" DataKeyNames="id" DataSourceID="SqlDataSourcePhieuGiamGia"
                    class="form">
                    <Columns>
                        
                        <asp:TemplateField HeaderText="STT">
                            <ItemTemplate>
                                <%# Container.DataItemIndex + 1 %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"
                            SortExpression="id" />
                        <asp:BoundField DataField="ngay_phat_hanh" HeaderText="ngay_phat_hanh" SortExpression="ngay_phat_hanh" />
                        <asp:BoundField DataField="id_mua_hang" HeaderText="id_mua_hang" SortExpression="id_mua_hang" />
                        <asp:BoundField DataField="ma_coupon" HeaderText="ma_coupon" SortExpression="ma_coupon" />
                    </Columns>
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSourcePhieuGiamGia" runat="server" ConnectionString="<%$ ConnectionStrings:babydealConnectionString %>"
                    DeleteCommand="DELETE FROM [coupon] WHERE [id] = @id" InsertCommand="INSERT INTO [coupon] ([ngay_phat_hanh], [id_mua_hang], [ma_coupon]) VALUES (@ngay_phat_hanh, @id_mua_hang, @ma_coupon)"
                    SelectCommand="SELECT * FROM [coupon]" UpdateCommand="UPDATE [coupon] SET [ngay_phat_hanh] = @ngay_phat_hanh, [id_mua_hang] = @id_mua_hang, [ma_coupon] = @ma_coupon WHERE [id] = @id">
                    <DeleteParameters>
                        <asp:Parameter Name="id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="ngay_phat_hanh" Type="DateTime" />
                        <asp:Parameter Name="id_mua_hang" Type="Int32" />
                        <asp:Parameter Name="ma_coupon" Type="Int32" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="ngay_phat_hanh" Type="DateTime" />
                        <asp:Parameter Name="id_mua_hang" Type="Int32" />
                        <asp:Parameter Name="ma_coupon" Type="Int32" />
                        <asp:Parameter Name="id" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </div>
        </div>
    </div>
</asp:Content>
